<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<link rel="stylesheet" href="<%=basePath%>/plugins/layui/css/layui.css"
	media="all" />
<link rel="stylesheet" href="<%=basePath%>/css/login.css" />
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<%@ include file="/common/pre/header.jsp"%>
<script src="${ctx}/statics/js/backend/backend.js"></script>
<!-- 弹窗 -->
<script
	src="https://cdn.bootcss.com/limonte-sweetalert2/6.4.1/sweetalert2.min.js"></script>
<link rel="stylesheet"
	href="https://cdn.bootcss.com/limonte-sweetalert2/6.4.1/sweetalert2.min.css">


	<script>
		function submit_form() {

			if ($("#faultId").val() != 0 && $("#computerroomId").val() != 0
					&& $("#classroomId").val() != 0
					&& $("#teacherId").val() != 0) {

				return true;
			} else {

				swal('Oops...', '選擇框有空', 'error')

				return false;
			}

		}
	</script>
</head>
<body>

	<c:if test="${mes != null}">
			<script>
				$(function(){
					
					swal('Oops...', '此故障已被提交', 'error')
					
				});
			</script>
		</c:if>
	<c:if test="${user == null}">
		<c:redirect url="login.jsp"></c:redirect>
	</c:if>
		
	<!--End Header End-->
<div class="i_bg bg_color">
    <!--Begin 用户中心 Begin -->
    <div class="m_content">
   
        <div class="m_right" id="content">
            <div class="mem_tit">
               		
            </div>
				<form action="/1and5Demo/repairList/addrapairlist2" method="post"
					onsubmit="return submit_form()">
					<table border="0" class="add_tab" style="width: 930px;"
						cellspacing="0" cellpadding="0">
						<tr>
							<td width="135" align="right">电脑编号</td>
							<td colspan="3">
					<input type="text" value="${computerId}" class="add_ipt" name="computerId" id="computerId" 
								<c:if test="${user.roName =='组长'|| user.roName =='维修人员'||user.roName =='老师'}">
									readonly="readonly"
								</c:if> />
							</td>
						
							
						</tr>
					 <tr>
                        <td width="135" align="right">设备故障</td>
                        <td>
                        <select name="faultName" id ="faultName">
                        
                      
									<c:forEach items="${faultList}" var="desc">
																		
											<option value="${desc.id }_${desc.faultType }">${desc.faultName }</option>
								
									</c:forEach>
								</select>
								</td>
						</tr>

						

						<tr>
							<td width="135" align="right">损坏时间</td>
							
							<td><input type="date" value="${faultTime }" class="add_ipt" 
								name="faultTime" 	<c:if test="${user.roName =='组长'|| user.roName =='维修人员'||user.roName =='老师'}">
									readonly="readonly"
								</c:if>/>
							</td>
								
						</tr>

						<!--   <tr>
                        <td width="135" align="right">故障类型</td>
                        <td>
                            <select name="faultType" id="faultType" >
                                <option value="个人设备" selected="selected">个人设备</option>
                                <option value="公共设备" selected="selected">公共设备</option>
                              
                            </select>
                        </td>
                    </tr>-->

						<tr>
							<td width="135" align="right">所属机房</td>
							<td>
								<select name="computerroomId" <c:if test="${user.roName =='组长'|| user.roName =='维修人员'||user.roName =='老师'}">
									disabled="disabled"
								</c:if>>

									<c:forEach items="${computerroom}" var="desc">
										<c:if test="${desc.id == selComputer.computerroomId}">
											<option value="${desc.id }" selected="selected">${desc.computerroomName }</option>
										</c:if>
										<c:if test="${desc.id != selComputer.computerroomId}">
											<option value="${desc.id }">${desc.computerroomName }</option>
										</c:if>
									</c:forEach>
								</select>
							</td>
						</tr>

						<tr>
							<td width="135" align="right">所属年级</td>
							<td>
								
							 <select name="classroomId" <c:if test="${user.roName =='组长'|| user.roName =='维修人员'||user.roName =='老师'}">
									disabled="disabled"
								</c:if>>

									<c:forEach items="${classroomInfo}" var="desc">
										<c:if test="${desc.id == selComputer.classId}">
											<option value="${desc.id }" selected="selected">${desc.className }</option>
										</c:if>

										<c:if test="${desc.computerroomId != selComputer.classId}">
											<option value="${desc.id }">${desc.className }</option>
										</c:if>
									</c:forEach>
								</select>

							</td>
						</tr>

						<tr>
							<td width="135" align="right">教 员</td>
							<td>
								<select name="teacherId" <c:if test="${user.roName =='组长'|| user.roName =='维修人员'||user.roName =='老师'}">
									disabled="disabled"
								</c:if>>

									<c:forEach items="${teacherList}" var="desc">
											<c:if test="${desc.id == selComputer.teacherId}">
												<c:if test="${user.roName =='组长' ||user.roName =='老师'||user.roName =='管理员' }">
												<option value="${desc.id }" selected="selected" >${desc.teacherName }</option>
												</c:if>
											
											</c:if>
										<c:if test="${desc.id != selComputer.teacherId}">
											<option value="${desc.id }">${desc.teacherName }</option>
										</c:if>
									</c:forEach>
								</select>
							</td>
						</tr>
							
						<tr>
							<td width="135" align="right" >审核状态</td>
							<td><select name="statusId">
							
							<c:if test="${user.roName =='组长'||user.roName =='老师'||user.roName =='维修人员' }">
									<option value="1" selected="selected">已提交</option>
							</c:if>
							<c:if test="${user.roName =='管理员' }">
									<option value="1" selected="selected">已提交</option>
									<option value="2" >待审核</option>
									<option value="3" >审核通过</option>
							</c:if>
								
							</select>
							</td>
						</tr>

						<tr>
							<td></td>
							<td>
			
								<input type="submit" value="添加信息" class="s_btn" onclick="checkDisabled()" />
							</td>
							<td>
							<input onclick="window.history.back();" class="s_btn" value="返回" />
							</td>
						</tr>
					</table>
				</form>
			</div>
		</div>
	</div>
	<script type="text/javascript"
		src="<%=basePath%>/plugins/layui/layui.js"></script>
	<script language=javascript>
		function checkboxTest(checkbox) {
			if (checkbox.checked) {
				checkbox.checked = "checked";
				alert("选中");
				alert(checkbox.checked)
			} else {

				alert("没有选中");
			}
		}
		
		//提交的时候释放
		function checkDisabled(){

			$('form select').removeAttr("disabled"); 
			$('form input').removeAttr("readonly"); 
		}
	</script>
</body>
</html>


